--- A pair of two applicative functors, both applied to the same type
package frege.data.Product where

import frege.Prelude hiding(product)

data Product f g a = Prod (f a) (g a)

instance (Functor f, Functor g) => Functor (Product f g) where
  fmap f (Prod fa ga) =  Prod (fmap f fa) (fmap f ga)

--- view a tuple as 'Product'
product = uncurry Prod 

--- make a tuple from a 'Product'
unproduct (Prod a b) = (a,b)